Recently, many rotary electric machines for an automotive vehicle are proposed. For example, Japanese Patent No. A-05-292703 proposes a liquid-cooled rotary electric machine integrated with an inverter, which cools both an inverter and a motor with a coolant. In this rotary electric machine, the inverter is fixed on the sidewall of the motor through a heat sink, and includes a semiconductor switching device and a smoothing capacitor. The heat sink cools both the motor and the inverter. However, the smoothing capacitor is big so that a large area is needed to attach the smoothing capacitor. Thus, a principal plane of the heat sink, where the smoothing capacitor is attached, necessarily becomes large. In addition, the semiconductor switching device generates a large amount of heat, so that the device needs to be cooled sufficiently. Therefore, the rotary electric machine has to be improved for a smaller size, lighter weight, and higher cooling performance.